package com.zn;

//import com.zn.socketReceiver.TickDataReceiver;
import com.zn.websocket.server.ChannelGroupsServer;
import com.zn.websocket.server.WebSocketServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.ComponentScan;
		import org.springframework.scheduling.annotation.EnableScheduling;

@EnableEurekaClient
@ComponentScan
@EnableScheduling
@EnableAutoConfiguration(exclude={
		DataSourceAutoConfiguration.class,
		DataSourceTransactionManagerAutoConfiguration.class})
@SpringBootApplication
public class EtfMdSocketApplication implements CommandLineRunner {
	private static final Logger LOGGER = LoggerFactory.getLogger(EtfMdSocketApplication.class);
	@Autowired
	WebSocketServer webSocketServer;
	@Autowired
	ChannelGroupsServer channelGroupsServer;
	@Value("${md.socket.host}")
	private String host;
	@Value("${md.socket.port}")
	private String port;
	@Value("${netty.websocket.port}")
	private String webSocketPort;

	public static void main(String[] args) {
		SpringApplication.run(EtfMdSocketApplication.class, args);
	}
	@Override
	public void run(String... strings) throws Exception {
//		LOGGER.warn("LocalInetAddress......."+LocalInetAddress.getLocalAddress()+",webSocketPort...."+webSocketPort);
		/**启动netty的webSocket服务端**/
		channelGroupsServer.Initialization();
		webSocketServer.run(Integer.valueOf(webSocketPort));
	}
}
